package one.stand.enums;

/**
 * 优惠类型
 * @author luoyang
 * @date 2020/4/29 15:36
 */
public enum CouponTypeEnums {
    // 优惠类型 1满减，2折扣
    FULL_REDUCTION(1,"满减劵"),DISCOUNT(2,"折扣劵");

    private Integer code;

    private String name;

    CouponTypeEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    // 普通方法
    public static String getName(int code) {
        for (CouponTypeEnums c : CouponTypeEnums.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        return null;
    }
}
